<include file="Common:header" />
<TYjs file='fix_table_title'/>
<style>
.success{width:20%;float:left;}
.success img{width:100%}
</style>
<div class="table_content">
	<a class="a_btn add_server_name" style="margin-bottom:10px;cursor:pointer;">添加服务项目</a>
    <form action="{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/delete_post')}" method="post" class="ajax_form">
        <table class="list_table">
            <tr>
                <th style="min-width:100px;">服務名</th>
                <th style="min-width:100px;">服務類型</th>
                <th style="min-width:100px;">創建時間</th>
                <th style="min-width:100px;">更新時間</th>
                <th style="min-width:100px;">是否顯示</th>
                <th width="130px">操作</th>
            </tr>
            <foreach name='list' item='vo'>
                <tr>
                    <td>{$vo.server_name}</td>
                	<td>
                        <switch name="vo['server_type']">
                                <case value="1">單次服務</case>
                                <case value="2">月卡服務</case>
                                <case value="3">通用服務</case>
                        </switch>
                    </td>
                	<td>{$vo.create_time|date="Y-m-d H:i",###}</td>
                	<td>{$vo.update_time|date="Y-m-d H:i",###}</td>
                    <td>
                    <input type="button" class="js_status status_{$vo['status']?'enable':'disable'}" url="{:U(MODULE_NAME.'/Server/change_server_status',array('id'=>$vo['id']))}"/>
                    </td>
                    <td>
                    <a class="delete" href="{:U(MODULE_NAME.'/Server/delete_server',array('id'=>$vo['id']))}" title="删除"></a>
                    </td>
                </tr>
            </foreach>
        </table>
    </form>
    <div id="add_name" style="display:none;">

     <form action="{:U(GROUP_NAME.'/'.MODULE_NAME.'/change_delivery')}" method="post" id="upForm">
        <table class="edit_table">
            <tr>
                <td class="tablehead">服务项目名</td>
                <td><input type="text" name="server_name" /></td>
            </tr>
            <tr>
                <td class="tablehead">服务类型</td>
                <td>
                	<span class="radio">
					<input type="radio" id="radio2" name="server_type" value="1" checked /><label for="radio2">单次</label>
                    <input type="radio" id="radio3" name="server_type" value="2" /><label for="radio3">月卡</label>
                    <input type="radio" id="radio4" name="server_type" value="3" /><label for="radio4">通用</label>
					</span>
				</td>
            </tr>
            <tr>
                <td class="tablehead"></td>
                <td><input type="button" name="confirm_server_name" value="确认" style="padding:6px 20px;"/></td>
            </tr>
        </table>
    </form>
    </div>
</div>
<script type="text/javascript">
    $(function() {
    	$('.add_server_name').click(function(){
    		art.dialog({
     			content: document.getElementById('add_name'),
    		});
    	});
    	$('input[name=confirm_server_name]').click(function(){
    		 var formData = new FormData($( "#upForm" )[0]);
    		$.ajax({
                url: "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/add_server_name')}" ,
                type: 'POST',
    	        data : formData,
    	        async: false,
    	        cache: false,
    	        contentType: false,
    	        processData: false,
    			dataType: 'json',
                success: function (returndata) {
               		if(returndata.status){
               		    callBackTips(returndata.status,returndata.info,returndata.url);
            		}else{
            			callBackTips(0,returndata.info);
            		}
                },
           });
    	});
    });
</script>
<include file="Common:footer" />
